package com.bfsoft.springbootinit.config.login;

public class UserContext {

    private static final ThreadLocal<UserDetail> userHolder = new ThreadLocal<>();

    // 设置用户详细信息
    public static void setUser(UserDetail userInfo) {
        userHolder.set(userInfo);
    }

    // 获取用户详细信息
    public static UserDetail getUser() {
        return userHolder.get();
    }

    // 清理用户信息
    public static void clear() {
        userHolder.remove();
    }
}

